import 'package:dartkit/dartkit.dart';
import 'package:test/test.dart';

void main() {
  test("Date格式化", () {
    final date = Date(2023, 3, 5);
    expect(date.format('YYYY-MM-DD'), equals('2023-03-05'));
    expect(date.format('YY-M-D'), equals('23-3-5'));
    expect(date.format('YYYY年M月D日'), equals('2023年3月5日'));
  });

  test("DateTime格式化", () {
    final DateTime time = DateTime(2000, 1, 1, 18, 4, 5);
    expect(time.format("YYYY-MM-DD(周WW) hh:mm:ss"), "2000-01-01(周六) 18:04:05");
    expect(time.format("YY-M-D(周W) h:m:s"), "00-1-1(周6) 18:4:5");
  });

  test("Duration格式化", () {
    final duration = Duration(days: 2, hours: 7, minutes: 5, seconds: 4);
    expect(duration.format("DD天hh时mm分ss秒"), "02天07时05分04秒");
    expect(duration.format("D天h时m分s秒"), "2天7时5分4秒");
  });
}
